<template>
	<el-container>
	  <el-header><el-button type="primary" @click="add_bt(0)">添加</el-button></el-header>
	  <el-main>
		  <el-table
			    :data="list"
			    border
			    style="width: 100%"
				 :stripe="true">
				 
				 <el-table-column label="头像">
				 　　<template slot-scope="scope">
				 　　　　<img :src="scope.row.headpic" width="30" height="30" class="head_pic"/>
				 　　</template>
				 </el-table-column>
				 
			    <el-table-column
			      prop="nickname"
			      label="昵称"
			     >
			    </el-table-column>
				
				<el-table-column
				  prop="login_time"
				  label="登录时间"
				 >
				</el-table-column>
				
				<el-table-column
				  prop="login_ip"
				  label="登录ip"
				 >
				</el-table-column>
				
				<el-table-column
				  prop="mobile"
				  label="绑定电话"
				 >
				</el-table-column>

			   
			  </el-table></el-main>
	  <el-footer>
		  <el-pagination
			style="margin-top: 50px;" background layout="prev, pager, next" :total="total"
				:page-size="size" @current-change="jump_page"
			>
			</el-pagination>
		</el-footer>
	</el-container>
	
	

		
	
	
</template>
<script>
import UserModel from '../../model/user.js'
export default {
  data() {
    return {
		 tableData: [],
		 form:{
			 name:'',
			 dir_name:''
		 },
		 img_list:{
			 url:''
		 },
		 title:['添加','编辑'],
		 total:0,
		 formLabelWidth:'120px',
		 size:10,
		 banner_item:[],
		 father_category:[],  
		 list:[],
		 dialogVisible:false,
		 drawer:false,
		 type:0,//0添加1编辑
		 
    }
  },
  mounted(){
	  console.log("loading")
	this.get_data()
  },
  methods: {
	  //获取数据
		get_data()
		{
			UserModel.get().then(res=>{
				this.tableData=res.data
				this.total=this.tableData.length
				this.list = res.data.slice(0, this.size)
			    loading.close();
			})
			
		
		},
		//分页跳转
		jump_page(e) {
			const that = this;
			let start = (e - 1) * that.size;
			let end = e * that.size;
			console.log(start, end)
			this.list = this.tableData.slice(start, end);
		},
		//关闭事件
		handleClose()
		{
			this.dialogVisible=false
			
		},
		clear_data()
		{

			this.form.name=''
			this.form.dir_name=''
		}
  },
  created() {
  },
  beforeUpdate() {},
  // 挂载前状态(里面是操作)
  beforeMount() {
  }
}
</script>
<style>
	.head_pic{
		width: 120px;
		height: 120px;
	}
	
	.picA {
		width: 148px;
		height: 148px;
		background-color: #FBFDFF;
		border: 1px dashed #C0CCDA;
		border-radius: 6px;
		box-sizing: border-box;
		vertical-align: top;
		text-align: center;
		margin: 6px;
	}
	
	.img {
		width: 144px;
		height: 144px;
		border: 1px solid #BFBFBF;
		border-radius: 3px;
	}
</style>
